Method and system for automated session resource clean-up in a distributed client-server environment

ABSTRACT

A system and method of automatic session resource clean-up resulting from a client-server session wherein the client has requested use of server resources during the session. During each session, a list of the resources allocated to that session and associated with the client is maintained and, when the session terminates, either naturally or unnaturally, the allocated resources are released or freed up, allowing later use of the same resources by a different session, either with the same client or with a different client. A session may terminate naturally because a program which is using the resource (such as a database) has completed its operation and ended normally. A session may also terminate unnaturally, e.g., because the connection between the client and the server has been broken for some reason or because a program has aborted or become hung in an inoperative state. Because such unnatural terminations do not normally provide a farewell message from the client to the server—only silence, from the lack of further processing messages—there is no way for the server to release the resource and no naturally occurring message to the server that the client is not present. The resent invention overcomes these disadvantages by determining when a session has ended and releasing the resources associated with the client.

CROSS REFERENCE TO RELATED PATENTS

[0001] The present invention is related to the following patents whichare specifically incorporated herein by reference:

[0002] Pending patent application Ser. No. 09/409,345(docketCHA9-1999-0004) filed Sep. 30, 1999 by Cessna et al. entitled “Frameworkfor Dynamic Hierarchical Grouping and Calculation based onMultidimensional Characteristics” and assigned to the assignee of thepresent invention. This patent is sometimes referred to herein as theFramework Patent.

[0003] Pending patent application Ser. No. 09/491,834(IBM docketCHA9-99-014) filed Jan. 26, 2000 by C. Bialik et al. entitled “Methodand System for Database Management for Supply Chain Management” andassigned to the assignee of the present invention. This patent issometimes referred to herein as the Database Patent.

[0004] Patent application Ser. No. (to be assigned for IBM docketCHA9-99-013) filed concurrently by the inventor of the present document,Iwao Hatanaka, and entitled “Method and System for Incorporating LegacyApplications into a Distributed Data Processing System” and assigned tothe assignee of the present invention. This patent is sometimes calledthe Legacy Application Patent.

[0005] Issued U.S. Pat. No. 6,021,493 of Daryl C. Cromer et al. entitled“System and Method for Detecting When a Computer System is Removed froma Network” issued on Feb. 1, 2000 and assigned to the assignee of thepresent invention. This patent is sometimes referred to herein as theHeartbeat Patent and is useful in detecting whether a client is attachedto a server.

BACKGROUND OF THE INVENTION

[0006] 1. Field of the Invention

[0007] The present invention is an improved system and method forautomatically managing session resources in a distributed network ofprocessors, such as a client-server environment, where the invention hasthe particular advantage of automatically releasing those resourcesallocated to a session when the session ends, whether through a normalending or through an abnormal ending. More particularly, the presentinvention includes a session management framework which can be appliedto release session resources when the session ends abnormally, e.g.,through the halting of an application or the loss of a connectionbetween the server and the client.

[0008] 1. BACKGROUND ART

[0009] In a client-server environment, a local terminal (sometimesreferred to as a client) is connected to a server for the purpose ofprocessing information in a distributed environment. Frequently, theclient is itself a data processing system which communicates with aserver which is generally a data processing system with increasedresources, including applications and data which are not available atthe client application. Such a system is described in some detail in theFramework Patent referenced above. In a client-server environment,resources may be centrally managed at the server as opposed to beingdisparately managed at each individual client. In some cases, the clientdoes not have the capability of managing or maintaining large resources.

[0010] The client is frequently located at a distance from the serverand communicates with the server using telecommunication facilities,including hardware and software operating over phone service such asmight be provided using telephone lines, either alone or in combinationwith other communication systems such as satellite or microwavecommunications. A series of communications occur between a client andits server (for example, to execute an application on the server usingdata supplied by the client and report the results of the applicationback to the client) is sometimes referred to as a session, with asession including a plurality of communications between the server andthe client. In any event, there are frequently several different linksin the communications chain, and when one of the links fails to operate,the communications channel is disrupted and the session is terminated.

[0011] While the session was in existence, various resources at theserver are dedicated or reserved for the use of the particular clientwhich requests use of those resources. So, in a supply chainapplication, a variety of storage units associated with the server maybe used by a client during a session and various applications anddatabases may be dedicated to the client and its session, often to thepreclusion of using those same resources for other clients while asession with the one client is in progress. Such a preclusion isunderstandable, particularly when an application may be changing theapplication or the database, so access during a change by anotherapplication may provide the wrong execution or the wrong data.

[0012] A session with a client “ties up” resources generally (memoryused for one application cannot be used at the same time for anotherapplication) and for some specific reasons (a client which is using adatabase typically marks the database so that another client cannotsimultaneously use the database and change the information stored in thedatabase while the other client is using the database, for example).

[0013] Since the resources are limited and other clients may want to usethe same resources, it is advantageous to release the resources as soonas the resources are not needed, and the normal termination of a session(e.g., the completion of execution of a program) typically provides arelease of the resources which have been used for the session as a partof the normal ending of the session.

[0014] But, when a session is abnormally terminated, it does not gothrough the normal ending or winding down process which releases theresources. In fact, many of the events which contribute to the abnormaltermination of a session result from a total lack of communications witha client, perhaps because the connection between the client and theserver is no longer functional. This is becoming more of a problem whenthe communication is over the public Internet or a virtual privatenetworks, where a large number of users are connected through pathswhich are constantly changing as the network evolves, and the sessiondepends on the continuing availability of a path between the client andthe server.

[0015] The Legacy Application Patent describes an approach to allow useof legacy applications in a distributed processing environment, allowinglegacy applications which were not designed to be utilized in adistributed processing system to be used in such a system. Such a systeminherently requires that resources which are being used in a distributeddata processing system be committed to the use and be released once theprocessing has ended.

[0016] Several approaches have been suggested for determining when asession is no longer active. One of these involves polling, or makingsure that the client and the server remain active by periodicallyissuing an inquiry from the one to the other with an answer back if theconnection is still in place. This involves setting up some kind ofperiodic inquiry system and keeping track of when an inquiry is due foreach of the clients, an exercise which requires resources and does notnecessarily provide a prompt notice that a client has been dropped bythe network—that is, without a lot of repeated polling of each clientevery short interval, the server does not know which clients remainattached and which clients are no longer attached But, polling requirescontinuing use of resource and suggests that polling ought to be done atlengthy intervals to reduce the use of network resources, but the longerthe interval, the longer resources may be dedicated to serve a sessionwhich no longer exists.

[0017] A prior art system for determine whether a resource is attachedsometimes uses a “heart beat” technique for determining whether theresource remains attached. But, in such a system a ping is sent outaddressed to the remote user and the absence of a response is taken tomean that the resource is not attached, when, in fact, the ping or itsresponse may have been misdirected or lost in the system without theresource actually being disconnected Another disadvantage of polling isthat message traffic is increased for each client which is added to thesystem. Also, there is the lack of an unequivocal indication that aresource is no longer needed or that a client is no longer connected.

[0018] Accordingly, the prior art systems have undesirable disadvantagesand limitations.

SUMMARY OF THE INVENTION

[0019] The present invention overcomes the limitations and disadvantagesof the prior art systems by providing a system and method for releasingresources dedicated to a session promptly, even when the session endsabnormally and without a termination message.

[0020] The present invention has the advantage that it is simple andeasy to implement to allow for the release of resources held for aclient when the client is no longer connected to the server.

[0021] The present invention allows for the prompt reallocation ofresources from a client to an other client when the first client is nolonger using the resource without polling or a periodic inquiry of theconnected status of each of the clients using resources of a givenserver.

[0022] The present invention involves setting up a resource manager foreach session and logging the use of resources associated with thatsession. Then, when the session is no longer active—for whatever reason,including normal disconnection or a lost connection, the resourcemanager consults the listing of resources associated with that sessionand releases the resources for use, allowing use with other sessions.

[0023] Using the resource manager for normal and abnormal sessionterminations means that it is not necessary to have two different typesof session terminations, one for normal terminations and a different onefor an abnormal termination.

[0024] The present system also allows for a table which identifies whichresource is associated with which user.

[0025] The present application is suited for use in a system such as aredescribed in the Legacy Application Patent. The use of a distributeddata processing solution means that different processors may havereserved resources such as applications which need to be resolved when asession ends.

[0026] A system such as the Heartbeat Patent may be used to determinewhether a client is attached to the server at any given time. Byperiodically querying the clients, it is possible to determine whetherthe client is still coupled to the server or if the connection has beenlost for some reason. The Heartbeat Patent is one way (but certainly notthe only way) to determine whether the client is still coupled to theserver and capable of communicating. If the Heartbeat Patent detectsthat a given client is no longer attached, it can signal the server toallow release of the resources associated with the client.

[0027] Other objects and advantages of the present invention will beapparent to those skilled in the relevant art in view of the followingdescription of the preferred embodiment, taken together with theaccompanying drawings and the appended claims.

BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The present invention is an improved system and method forresource cleanup, an embodiment of which is illustrated with referenceto the accompanying drawings in which:

[0029]FIG. 1 depicts a communications system representative of thepreferred embodiment of the present invention;

[0030]FIG. 2, consisting of FIG. 2A and FIG. 2B, are flow diagrams ofthe preferred embodiment of the present invention; and

[0031]FIG. 3, consisting of FIG. 3A and FIG. 3B, are diagramsillustrating resource tables useful in practicing the present invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

[0032] In the following description of the preferred embodiment, thebest implementation of practicing the invention presently known to theinventors will be described with some particularity. However, thisdescription is intended as a broad, general teaching of the concepts ofthe present invention in a specific embodiment but is not intended to belimiting the present invention to that as shown in this embodiment,especially since those skilled in the relevant art will recognize manyvariations and changes to the specific structure and operation shown anddescribed with respect to these figures.

[0033]FIG. 1 illustrates a communications system of the type used in thepresent invention. In this FIG. 1, a first client (CLIENT1) 100 isconnected to a first server (SERVER1) 110 through a network 120.Additional clients (CLIENT2, CLIENT3, CLIENT4) 131, 132, 133,respectively are shown also connected to the first server 110 throughthe network 120 and additional servers (SERVER2, SERVER3 and SERVER4)141, 142, 143, respectively are also shown connected to the network 120.While this is a simplistic view of a network in which a plurality ofservers are connected to serve a plurality of clients, it will allowdiscussion of the problems with such an arrangement and an understandingof the present invention and its advantages The first client 100 mayinvolve an application which uses a resource at the first server 110(for example, an application APPLN1 referred to by the reference numeral111) and a resource at the second server 141 (for example, a database DBreferred to by the reference numeral 151) and store the result in a file152 maintained on the third server 142 (the file 152 might be a filewith pro forma income and profit projections), all of which dataprocessing is accomplished through the communications network 120 whichconnects the client 110 with the servers 110, 141 and 142. Meanwhile,the second client 131 may wish to use resources at the first server 110,the second server 141 and a fourth server 143. If the second client 131is using different resources at the servers from the other clients atany given time, then there is no problem. If, however, the first client100 is using the particular application APPLN1 111 at the first server110, then the second client may not be permitted to use the applicationAPPLN1 111 at that same time, but would be permitted to use anapplication APPLN2 112 which is also at the first server.

[0034] The present invention leverages the fact that each client sessionwith a server is associated with a single file descriptor in the serverduring a client connection to the server. All communications from and tothat client takes place through that file descriptor. Through a callbackprogram associated with that file descriptor, client termination eventscan be captured to trigger desired system processing at precisely thetime that the client disconnects from the server. This functionalityallows for automatic session clean-up by detecting client terminationand then freeing up corresponding resources being held on the server forthe terminated client session.

[0035]FIG. 2 illustrates in flow diagram form the logic of the presentinvention showing aspects of the present invention. FIG. 2 consists ofFIG. 2A and FIG. 2B. FIG. 2A shows logic for the determination ofwhether a resource is available and assigning the resource to aparticular requesting client while FIG. 2B shows logic for determiningwhether to release a resource and the steps taken to release thatresource and allow for further use of the resource by other clients.

[0036]FIG. 2A illustrates the process of a client using resources at aserver as was described in connection with FIG. 1. The process starts atblock 202 and at block 204 a request is received by the server forresources associated with that server, resources which may be use of anapplication, access to a database stored on the server or simply to ablock of memory, for example, as a temporary storage for an application.While the server may have a large number of resources and many of theseresources are not unique (one block of empty memory may be similar tothe next), others of the resources are unique (the server may have asingle copy of an application or a database) and the resources arelimited (the server might well run out of memory if the memory were notreleased and reused by a second client after the first has completed itsprocessing). Based on the request received at the block 204 forresources, at block 206 the server determines whether the resource isavailable to the requesting client. Such availability is determined inconnection with resource listings such as FIG. 3, particularly FIG. 3Bwhich identifies each resource as being available or being used by anamed client. If the client is requesting use of a database already inuse by another client or if the memory requested is not available, thenthe request is denied at block 208 with an appropriate message(“resource in use; try again later” or “inadequate memory presentlyavailable; try elsewhere or try again later”). If, on the other hand,the resource is available for the client, then at block 210, access isgranted and the resource is logged (see FIG. 3 and the associated textfor a discussion of the logging process to include identification ofwhich resources are available and which are used by which clients) asassigned to the requesting client. In any event, following thedisposition of a request for resources, either by granting it at block210 or denying it at block 208, control returns to the starting areawhere the next request can be processed by the block 204.

[0037]FIG. 2B illustrates the process for releasing a resource which hasbeen assigned to a client and for which the client no longer has a needfor the resource. Such a release may be because the program using theresource has run its course and terminated successfully or becausesomething unnatural has occurred, like the client has becomedisconnected from the server —i.e., either the server 110 or the client100 is no longer connected to the network 120 or the client 100 is nolonger operational. While a normal termination of an application programmay issue the explicit command to release the resources that theapplication has been using, the program may abort or otherwise not issuesuch a command.

[0038] The process of FIG. 2B is as follows: starting from block 220, atblock 222 the question is asked whether a client has specificallyreleased a resource. If not, then at block 224, it is determined whetherthe client remains attached to the network. This determination can bemade through any of a number of conventional approaches, such as“pinging” the client or by determining a heartbeat of the client usingthe Heartbeat Patent referenced above. If the client is present, thencontrol passes to an optional set of time determinations which serve tolimit the time that a resource can be used —either with activity orwithout activity. Associated with the resource (e.g., an application,database or memory) and/or the client are allowable time intervals. Forexample, a client may use a first application for 30 minutes but will beconsidered inactive if no activity occurs within a 15 minute timeperiod. Thus, at block 226 the amount of time a resource has been usedwill be compared with an allowable time for such use (if any has beenset) by comparing the present time with the beginning time which wasstored in column 308 of FIG. 3A to determine the amount of time theresource has been in use. If the time that the resource has been useddoes not exceed the limit, then the amount of inactive time is comparedat block 228. That is, the period since the last use (in column 310 ofFIG. 3) to the present is compared with a threshold (if set) todetermine whether the resource has been held without activity longerthan a preset period of time. If the client released the resource (atblock 222), the client is not attached (at block 224), the time of use(block 226) or the time of inactivity (block 228) exceed the set limits,then the resource is released at block 230 with the entry in the tableof resources being used (FIG. 3A) erased at block 232 and the resourcemarked as available in the listing of FIG. 3B at block 234. Control thenreturns to the start for the next resource action.

[0039]FIG. 3 shows resource tables useful in practicing the presentinvention. In FIG. 3A, a first table 300 depicts in list form theresources currently being used and the client using each of theresources. Although only a portion of this table 300 is shown toillustrate the principles of the present invention, the table could beas large as necessary to contain data about all the clients using theserver and the resources that each of the clients is currently using.The table includes a first column 302 which lists the resource beingused, a second column 304 listing the client using the resource, a thirdcolumn 306 indicating the type of access (whether it is read only orread/write), a fourth column 308 indicating the time which the resourcewas first accessed and a fifth column 310 indicating the time that theresource was last used. Use of the fourth column 308 with the beginningtime allows for a time limit to be set for release of the resource aftera fixed amount of time and the fifth column 310 (last use) allows for atime limit to be set that releases a resource if it has not been usedwithin a fixed period of time. That is, the resource could be releasedafter x minutes of use (based on a comparison of the current time withthe start time stored in column 308) or after y minutes of nonuse (basedon a comparison of the current time with the time in column 310). Thetimes allowed (x minutes of use, y minutes of nonuse) are subject tosystem constraints and may be adjusted based on the type of use andwhether concurrent uses are permitted. In some situations, a read-onlyaccess of a resource may not preclude others' use of the same resourceand one client might be permitted to continue to use such a resource ona non-exclusive basis than would be permitted if the resource were beingused on an exclusive basis. An optional sixth column 312 provides thetime of the last indication that the client is connected, a time whichmay be provided by receiving a request from the client or from a return“ping” of the client as discussed elsewhere.

[0040] In FIG. 3B, a listing of the resources is provided and anassociated status for each resource—whether the resource is “free” foruse by a client or if it is currently committed to a client and notavailable. This FIG. 3B lists each of the resources along with itsstatus, by resource. So, FIG. 3B includes a left column 330 which liststhe resource and a right column 332 which either lists he resource asbeing used by a named client or being available. This, for the simpleexample of FIG. 1, APPLN1 is shown in block 334 as a resource and inblock 344, it is being used by client 110. APPLN2 is listed in block 336as a resource and in block 346, it is being used by client 131. APPLN3is listed in block 338 as being available in block 348. Similarly blocksof memory and other resources such as the database DB can be assigned toa particular client, and at the end of the use by that client, releaseby removing the entry in the columns of FIG. 3.

[0041] The present invention can be realized in hardware, software, or acombination of hardware and software. A data processing tool accordingto the present invention can be realized in a centralized fashion in onecomputer system, or in a distributed fashion where different elementsare spread across several interconnected computer systems. Any kind ofcomputer system—or other apparatus adapted for carrying out the methodsdescribed herein—is suited. A typical combination of hardware andsoftware could be a general purpose computer system with a computerprogram that, when being loaded and executed, controls the computersystem such that it carries out the methods described herein. Thepresent invention can also be embedded in a computer program product,which comprises all the features enabling the implementation of themethods described herein, and which—when loaded in a computer system—isable to carry out these methods.

[0042] “Computer program means” or “computer program” in the presentcontext mean any expression, in any language, code or notation, of a setof instructions intended to cause a system having an informationprocessing capability to perform a particular function either directlyor after either or both of the following a) conversion to anotherlanguage, code or notation; b) reproduction in a different materialform.

[0043] While the present invention is described in the context of anapparatus and a method of providing resource management, the presentinvention may be implemented in the form of a service where collecting,maintaining and processing of information is located apart from theserver and information is communicated as needed to the server.

[0044] Of course, many modifications of the present invention will beapparent to those skilled in the relevant art in view of the foregoingdescription of the preferred embodiment, taken together with theaccompanying drawings. For example, the system for recognizing that thesession between the client and the server no longer exists may bedetermined in any manner and is not limited to that disclosed in theforegoing material. Additionally, the location and type of informationmaintained about a session may be modified to suit the application andneed not be the listing of resources associated with each client asdisclosed. Such information may be stored in connection with eachresource being used rather than in a central location, although thereare advantages to having the information located centrally in that acentral location makes it easier and quicker to release and reuse theresource again. Additionally, certain features of the present inventionmay be useful without the corresponding use of other features withoutdeparting from the spirit of the present invention. For example, aclient may be using several resources associated with differentapplications and one application may end (so the resources associatedwith that application should be released) or the entire connection mayterminate (so all applications terminate). Further, the system of FIG.3B arranges data on resource use including the same data as FIG. 3A, andthe two could be combined, if desired, using a single database to showwhat resources are in use and what clients are using the resource.Accordingly, the foregoing description of the preferred embodimentshould be considered as merely illustrative of the principles of thepresent invention and not in limitation thereof.

Having thus described the invention, what is claimed is:
 1. A system formanaging the use of resources in a system where a remote client usesresources at a server for a limited duration, the system comprising: astored listing of at least one resource being used at the server and theclient using that resource; a system which identifies that a remoteclient is no longer using resources at the server; and in response tothe system identifying that the client is no longer using resources atthe server, a mechanism which removes the resources which had been usedby the client when the client was connected to the server, whereby theresources being used by a client may be used by other clients after theclient has disconnected from the server.
 2. A system for managing theuse of resources in a system including the elements of claim 1 whereinthe system which identifies that a remote client is no longer using aresource at the server includes a mechanism for determining that theclient is no longer connected to the server through a data transmissionnetwork.
 3. A system for managing the use of resources in a systemincluding the elements of claim 1 wherein the system which identifiesthat a remote client is no longer using a resource at the serverincludes a system for determining that the program which uses theresource has terminated.
 4. A system for managing the use of a resourcein a system including the elements of claim 1 wherein the servermaintains a listing of each of the clients using a resource associatedwith the server and the resources which are used by the respectiveclient.
 5. A method of controlling the use of resources at a server byclients which are coupled to the server to use the resources, the stepsof the method comprising: identifying a client which is using the serverand the resources of the server which are associated with the client;detecting when the client is no longer using the resources of theserver; and in response to the detecting that the client is no longerusing resources of the server, releasing the resources at the serverwhich had been associated with the client.
 6. The method of controllingthe use of resources at a server by a client including the steps ofclaim 5 and further including the step of detecting that the client hasbecome disconnected from the server.
 7. The method of controlling theuse of resources at a server by a client including the steps of claim 5and further including the step of maintaining a list of the resourcesbeing used by each client using the server.
 8. The method of controllingthe use of resources at a server by a client including the steps ofclaim 5 wherein the method further includes maintaining a list ofresources being used by a client, maintaining a record of the time whenthe use of the resource started and the time when the resource was lastused and using the record of at least one of the times to determinewhether to release the resource.
 9. A method of controlling use of aresource at a server by a client, the steps of the method comprising:when a client requests use of a resource at a server, entering theidentity of the client, the resource and the time into a resources usedlisting; when a client subsequently uses the resource, entering the timeof last use of the resource into the resources used listing; permittinga client to control a resource while the client is connected and usingthe resource; and determining whether a client has been using a resourcewithin a predetermined period of time and, if not, releasing theresource.
 10. A stored program fixed on a medium for controlling the useof a resource comprising: a module which stores a list of the resourceswhich are being used by an identified client at a server; a module whichdetermines when the identified client is no longer using resourcesassociated with the server; and a module which determines the resourcesused by the identified client and releases those resources in responseto determining that the identified client is no longer using resourcesassociated with the server.
 11. A stored program of the type describedin claim 10 wherein the module for determining that the identifiedclient is no longer using resources includes a mechanism for determiningthat the client is no longer connected to the server.